﻿<div class="d-flex align-center flex-wrap mb-4 app-heading">
    <h1 class="m-heading text-h3 text-sm-h3 " id="@Meta.Title.HashToAnchorString()">@Meta.Title</h1>
    @if (!string.IsNullOrWhiteSpace(Meta.Tag))
    {
        <MChip Class="tag-chip px-2 ml-4" Label Color="primary" TextColor="white">@Meta.Tag</MChip>
    }
    @if (AdditionalTags.Any())
    {
        foreach (string item in AdditionalTags)
        {
            <MChip Class="tag-chip px-2 ml-4" Label Color="primary" TextColor="white">@item</MChip>
        }
    }
</div>

<MMarkdownIt Source="@Meta.Description" NoWrapper Scope="desc"></MMarkdownIt>

@ChildContent

@code {

    [Parameter]
    [EditorRequired]
    public FrontMatterMeta Meta { get; set; } = null!;

    [Parameter]
    public List<string> AdditionalTags { get; set; } = new();

    [Parameter]
    public RenderFragment? ChildContent { get; set; }

    private string? _prevYaml;

    public override async Task SetParametersAsync(ParameterView parameters)
    {
        await base.SetParametersAsync(parameters);

        ArgumentNullException.ThrowIfNull(Meta);
    }

}
